package net.lab1024.sa.admin.module.business.erp.poo.controller;

import net.lab1024.sa.admin.module.business.erp.poo.domain.form.StoordaAddForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.StoordaQueryForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.StoordaUpdateForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.vo.StoordaVO;
import net.lab1024.sa.admin.module.business.erp.poo.service.StoordaService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 采购入库单行 Controller
 *
 * @Author AKITA
 * @Date 2025-07-25 09:41:00
 * @Copyright AKITA
 */

@RestController
@Tag(name = "采购入库单行")
public class StoordaController {

    @Resource
    private StoordaService stoordaService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/stoorda/queryPage")

    public ResponseDTO<PageResult<StoordaVO>> queryPage(@RequestBody @Valid StoordaQueryForm queryForm) {
        return ResponseDTO.ok(stoordaService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/stoorda/add")

    public ResponseDTO<String> add(@RequestBody @Valid StoordaAddForm addForm) {
        return stoordaService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/stoorda/update")

    public ResponseDTO<String> update(@RequestBody @Valid StoordaUpdateForm updateForm) {
        return stoordaService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/stoorda/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return stoordaService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/stoorda/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return stoordaService.delete(id);
    }
}
